package com.example.test.rabbit;

import com.example.test.util.JacksonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RabbitConsumer {

    @RabbitListener(queues = "#{localQueue.name}")
    public void messageHandle(String msg) {
        RabbitMessage message = JacksonUtil.toBean(msg, RabbitMessage.class);
        switch (message.getBizType()) {
            case 1:
                PersonDTO personDTO = JacksonUtil.toBean(message.getData(), PersonDTO.class);
                // ...
                break;

        }
    }


}
